package org.ntu.rtsearch.index.model;

import java.util.List;

public class Posting {

	private int docId;
	
	private int termFreq;
	
	private long timeStamp;
	
	private int fieldId;
	
	private List<Integer> positions; 

	public Posting(Document doc, int fieldId, List<Integer> positionInfo) {
		this.docId = doc.getDocId();
		this.timeStamp = doc.getTimeStamp();
		this.fieldId = fieldId;
		this.termFreq = positionInfo.size();
		this.positions = positionInfo;
	}
	
	public long getSizeInByte() {
		return 20 + 5 * positions.size();
	}
	
	
	public synchronized int getDocId() {
		return docId;
	}

	public synchronized void setDocId(int docId) {
		this.docId = docId;
	}

	public synchronized int getTermFreq() {
		return termFreq;
	}

	public synchronized void setTermFreq(int termFreq) {
		this.termFreq = termFreq;
	}

	public synchronized List<Integer> getPositions() {
		return positions;
	}

	public synchronized void setPositions(List<Integer> positions) {
		this.positions = positions;
	}

	public synchronized long getTimeStamp() {
		return timeStamp;
	}

	public synchronized void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public void setPostions(List<Integer> postions) {
		this.positions = postions;
	}

	public List<Integer> getPostions() {
		return positions;
	}

	public void setFieldId(int fieldId) {
		this.fieldId = fieldId;
	}

	public int getFieldId() {
		return fieldId;
	}

}
